Movement

Info
Tips
  • Tips .

    • Good video, very complete.

  • diw and diW .

  • Vertical .

    • Keep the cursor in the center of the screen while doing pageup and pagedown

      • nnoremap("<C-d>", "<C-d>zz")

      • nnoremap("<C-u>", "<C-u>zz")

  • Horizontal .

  • Tips 1 .

    • Don't use hjkl.

    • Don't use f, F, t, or T too often as it requires ; or , to advance to where you want.

    • Use viw or viW more often, etc.

    • He prefers:

      • VD instead of dd.

      • VY instead of yy.

    • Use xnoremap("<leader>p", "\"_dP")  to "fix" Put behavior, so it doesn't store the previously selected text during Put.

      • That is, it makes the behavior similar to Ctrl V on Windows.

  • Tips 2 .

    • 'ctrl d' and 'ctrl u' are disorienting, but useful after a while.

Practice
Movement
  • $ hjkl

    • movement

  • $ M

    • set cursor to the middle

Movement: Vertical
  • Line

    • :30

      • goes to line 30

    • 30

      • advances 30 lines

        • beginning of the line above

        • beginning of the line below

  • Scroll:

    • ctrl e

      • scroll down

    • ctrl y

      • scroll up

    • /NUM%

      • go to a % of the file

  • Page

    • ctrl d

      • page down

    • ctrl u

      • page up

  • File

    • gg

      • go to start of the file

    • G

      • go to bottom of the file

      • 450G

        • go to line 450

      • 450gg

        • go to line 450

Movement: Horizontal
  • Paragraphs

    • {

      • up paragraph

    • }

      • down paragraph

  • Line

    • 0

      • BOL

    • |

      • BOL

    • _

      • BOL, without spaces or tabulation

    • $

      • EOL

    • g_

      • EOL, without spaces or tabulation

  • Word:

    • w

      • next word

      • 3w

        • 3 words forward

    • W

      • next WORD

    • b

      • previous word

      • 3b

        • 3 words back

    • B

      • previous WORD

    • e

      • end of the next word

      • 2e

        • end of 2 words forward

    • E

      • end of the next WORD

    • ge

      • end of the previous word

    • ge

      • end of the previous WORD

  • Char

    • f{char}

      • find char to the right

      • fy

        • find the first char y to the right of the cursor

    • F{char}

      • find char to the left

      • Fy

        • find the first char y to the left of the cursor

    • t{char}

    • T{char}

    • $ ;

      • repeat latest f, F, t, T

    • $ ,

      • repeat latest f, F, t, T in the opposite direction

  • /

    • /somename

      • searches for somename

      • pressing Enter ends the search

      • pressing n goes to the next result

      • pressing N goes to the previous result

  • ?

    • ?somename

      • searches for somename in the opposite direction

      • pressing Enter ends the search

      • pressing n goes to the next result

      • pressing N goes to the previous result

      • next occurrence of the hovered word

        • stores the word in the / search

  • #

    • previous occurrence of the hovered word

      • stores the word in the ? search

  • % (while inside a parenthesis)

    • goes to its pair

Jumps
  • :ju

    • sees the jump list

  • :cle

    • clears the jump list

  • $ ctrl o

    • older position in a jump list

  • $ ctrl i

    • newer position in a jump list

Marks
  • '{char}

    • go to mark

    • ' '

      • toggle between recent marks

  • "{char}

    • register a mark

  • $ m

    • register a mark

  • :delmarks A-Z0-9

    • Note: ~/.viminfo  contains histories and marks, if you don't want them anymore, you can delete this file. Vim will recreate it next time.

Registers
  • $ "{char}

    • go to registers

Telescope
  • esc

    • close

  • $ ctrl c

    • close

  • ?

    • Keymap help.

  • Selection :

    • Scroll selection:

      • Insert mode:

        • tab

          • scroll up

        • shift tab

          • scroll down

        • ctrl n

          • scroll down

        • ctrl p

          • scroll up

      • Normal mode:

        • tab

          • scroll up

        • shift tab

          • scroll down

        • ctrl n

          • scroll down

        • ctrl p

          • scroll up

        • j

          • scroll down

        • k

          • scroll up

    • Open:

      • About .

      • ctrl t

        • open as a new tab

      • ctrl x

        • open as a horizontal split

      • ctrl v

        • open as a vertical split

  • Preview :

    • Scroll:

      • ctrl d

        • scroll down

      • ctrl u

        • scroll up

      • ctrl f

        • scroll left

      • ctrl k

        • scroll right